/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.farmcode.api.types.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author oiprado
 */
@Entity
@Table(name = "FC_COLUMN_BY_DATABASE")
@NamedQueries({
  @NamedQuery(name = "ColumnByDatabase.findAll", query = "SELECT c FROM ColumnByDatabase c")})
public class ColumnByDatabase implements Serializable {
  private static final long serialVersionUID = 1L;
  @Id
  @Basic(optional = false)
  @NotNull
  @Column(name = "ID")
  private Long id;
  @Size(max = 50)
  @Column(name = "MAP_VAL")
  private String mapVal;
  @JoinColumn(name = "LANGUAGE_ID", referencedColumnName = "ID")
  @ManyToOne
  private Language language;
  @JoinColumn(name = "DATABASE_ID", referencedColumnName = "ID")
  @ManyToOne
  private Database database;
  @JoinColumn(name = "COLUMN_TYPE_ID", referencedColumnName = "ID")
  @ManyToOne
  private ColumnType columnType;

  public ColumnByDatabase() {
  }

  public ColumnByDatabase(Long id) {
    this.id = id;
  }

  public Long getId() {
    return id;
  }

  public void setId(Long id) {
    this.id = id;
  }

  public String getMapVal() {
    return mapVal;
  }

  public void setMapVal(String mapVal) {
    this.mapVal = mapVal;
  }

  public Language getLanguage() {
    return language;
  }

  public void setLanguage(Language languageId) {
    this.language = languageId;
  }

  public Database getDatabase() {
    return database;
  }

  public void setDatabase(Database databaseId) {
    this.database = databaseId;
  }

  public ColumnType getColumnType() {
    return columnType;
  }

  public void setColumnType(ColumnType columnTypeId) {
    this.columnType = columnTypeId;
  }

  @Override
  public int hashCode() {
    int hash = 0;
    hash += (id != null ? id.hashCode() : 0);
    return hash;
  }

  @Override
  public boolean equals(Object object) {
    // TODO: Warning - this method won't work in the case the id fields are not set
    if (!(object instanceof ColumnByDatabase)) {
      return false;
    }
    ColumnByDatabase other = (ColumnByDatabase) object;
    if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
      return false;
    }
    return true;
  }

  @Override
  public String toString() {
    return "com.farmcode.api.types.model.ColumnByDatabase[ id=" + id + " ]";
  }
  
}
